using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Easislides
{
	public class FrmBibleRename : Form
	{
		private IContainer components = null;
		private Label label1;
		private TextBox textBoxNewString;
		private Button BtnCancel;
		private Button BtnOK;
		private string InString = "";
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
            this.label1 = new System.Windows.Forms.Label();
            this.textBoxNewString = new System.Windows.Forms.TextBox();
            this.BtnCancel = new System.Windows.Forms.Button();
            this.BtnOK = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(12, 21);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(306, 31);
            this.label1.TabIndex = 3;
            this.label1.Text = "Rename:";
            // 
            // textBoxNewString
            // 
            this.textBoxNewString.Location = new System.Drawing.Point(13, 55);
            this.textBoxNewString.Name = "textBoxNewString";
            this.textBoxNewString.Size = new System.Drawing.Size(305, 20);
            this.textBoxNewString.TabIndex = 0;
            // 
            // BtnCancel
            // 
            this.BtnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.BtnCancel.Location = new System.Drawing.Point(171, 92);
            this.BtnCancel.Name = "BtnCancel";
            this.BtnCancel.Size = new System.Drawing.Size(80, 24);
            this.BtnCancel.TabIndex = 2;
            this.BtnCancel.Text = "Cancel";
            this.BtnCancel.Click += new System.EventHandler(this.BtnCancel_Click);
            // 
            // BtnOK
            // 
            this.BtnOK.Location = new System.Drawing.Point(75, 92);
            this.BtnOK.Name = "BtnOK";
            this.BtnOK.Size = new System.Drawing.Size(80, 24);
            this.BtnOK.TabIndex = 1;
            this.BtnOK.Text = "OK";
            this.BtnOK.Click += new System.EventHandler(this.BtnOK_Click);
            // 
            // FrmBibleRename
            // 
            this.AcceptButton = this.BtnOK;
            this.CancelButton = this.BtnCancel;
            this.ClientSize = new System.Drawing.Size(330, 128);
            this.Controls.Add(this.BtnCancel);
            this.Controls.Add(this.BtnOK);
            this.Controls.Add(this.textBoxNewString);
            this.Controls.Add(this.label1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FrmBibleRename";
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Rename Bible";
            this.Load += new System.EventHandler(this.FrmRename_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		public FrmBibleRename()
		{
			this.InitializeComponent();
		}
		private void FrmRename_Load(object sender, EventArgs e)
		{
			this.InString = gf.Trim(gf.Rename_String);
			this.label1.Text = "Rename '" + gf.Rename_String + "' to:";
			gf.Rename_ExistingString = gf.Rename_ExistingString.ToLower();
			this.textBoxNewString.Text = gf.Rename_String;
			this.textBoxNewString.SelectAll();
		}
		private void BtnCancel_Click(object sender, EventArgs e)
		{
			base.Close();
		}
		private void BtnOK_Click(object sender, EventArgs e)
		{
			this.textBoxNewString.Text = gf.Trim(this.textBoxNewString.Text);
			if (this.textBoxNewString.Text.Length > 0)
			{
				if (this.textBoxNewString.Text == gf.Rename_String)
				{
					base.Close();
				}
				else
				{
					if (gf.Rename_ExistingString.IndexOf(this.textBoxNewString.Text.ToLower()) < 0)
					{
						gf.Rename_String = this.textBoxNewString.Text;
						base.DialogResult = DialogResult.OK;
						base.Close();
					}
					else
					{
						MessageBox.Show("Name already exists! Please try a different Bible Name.");
					}
				}
			}
			else
			{
				MessageBox.Show("Please enter a new Bible Name.");
			}
		}
	}
}
